using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class f_cumasMap : EntityTypeConfiguration<f_cumas>
    {
        public f_cumasMap()
        {
            // Primary Key
            this.HasKey(t => new { t.clientno, t.title, t.name, t.init, t.address, t.address2, t.teleph, t.telex, t.fax, t.contact, t.discper, t.discper2, t.sector, t.lastdate, t.lastpaydat, t.crlimit, t.credcurno, t.cusmatper, t.smanno, t.iatacode, t.lbdboy, t.lpdboy });

            // Properties
            this.Property(t => t.clientno)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.title)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(5);

            this.Property(t => t.name)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.init)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(9);

            this.Property(t => t.address)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.address2)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.teleph)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.telex)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.fax)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.contact)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(30);

            this.Property(t => t.discper)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.discper2)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.sector)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.crlimit)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.credcurno)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.cusmatper)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.smanno)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.iatacode)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("f-cumas");
            this.Property(t => t.clientno).HasColumnName("clientno");
            this.Property(t => t.title).HasColumnName("title");
            this.Property(t => t.name).HasColumnName("name");
            this.Property(t => t.init).HasColumnName("init");
            this.Property(t => t.address).HasColumnName("address");
            this.Property(t => t.address2).HasColumnName("address2");
            this.Property(t => t.teleph).HasColumnName("teleph");
            this.Property(t => t.telex).HasColumnName("telex");
            this.Property(t => t.fax).HasColumnName("fax");
            this.Property(t => t.contact).HasColumnName("contact");
            this.Property(t => t.discper).HasColumnName("discper");
            this.Property(t => t.discper2).HasColumnName("discper2");
            this.Property(t => t.sector).HasColumnName("sector");
            this.Property(t => t.lastdate).HasColumnName("lastdate");
            this.Property(t => t.lastpaydat).HasColumnName("lastpaydat");
            this.Property(t => t.crlimit).HasColumnName("crlimit");
            this.Property(t => t.credcurno).HasColumnName("credcurno");
            this.Property(t => t.cusmatper).HasColumnName("cusmatper");
            this.Property(t => t.smanno).HasColumnName("smanno");
            this.Property(t => t.iatacode).HasColumnName("iatacode");
            this.Property(t => t.lbdboy).HasColumnName("lbdboy");
            this.Property(t => t.lpdboy).HasColumnName("lpdboy");
        }
    }
}
